package innersort;
/*
* 沉石排序，与冒泡排序顺序相反
* */
public class StoneSort extends BaseSort {
    public static void main(String[] args) {
        int[] array = {2, 23, 25, 35, 1, 7, 9, 22, 25, 23, 16, 28, 30};
        sort(array);
    }

    public static void sort(int[] array) {
        for (int i = array.length - 1; i >= 0; i--) {
            for (int j = 0; j < i; j++) {
                if (array[j] > array[j + 1]) {
                    exchange(array, j, j + 1);
                }
                print(array, j, j + 1);
            }
        }
    }
}
